//
//  GLBaseHTTPTool.h
//  SXBPurchase
//
//  Created by huanggulong on 2017/10/8.
//  Copyright © 2017年 历山大亚. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "GLHTTPParam.h"
#import "GLHTTPResult.h"

@interface GLBaseHTTPTool : NSObject

/**
 网络请求
 
 @param url 请求的url
 @param param 参数
 @param modelClass 结果模型
 @param success 成功的回调 会有一个模型返回
 @param failure 失败的回调 会有一个错误对象返回
 @return 当前网络请求的任务对象
 */
+(NSURLSessionDataTask *)baseRequestURL:(NSString *)url requestParam:(GLHTTPParam *)param resultModelType:(Class)modelClass success:(void (^)(id result))success failure:(void (^)(NSError *error))failure;


+(NSURLSessionDataTask *)jsonRequestURL:(NSString *)url requestParam:(GLHTTPParam *)param resultModelType:(Class)modelClass success:(void (^)(id result))success failure:(void (^)(NSError *error))failure;

+(NSURLSessionDataTask *)getRequestURL:(NSString *)url requestParam:(GLHTTPParam *)param resultModelType:(Class)modelClass success:(void (^)(id result))success failure:(void (^)(NSError *error))failure;

/**
 简易的网络请求方法(返回数据只有状态码和错误信息)
 
 @param url 请求的url
 @param param 请求参数
 @param success 成功的回调 会有一个模型返回
 @param failure 失败的回调 会有一个错误对象返回
 @return 当前网络请求的任务对象
 */
+(NSURLSessionDataTask *)baseRequestURL:(NSString *)url requestParam:(GLHTTPParam *)param success:(void (^)(GLHTTPResult * result))success failure:(void (^)(NSError *error))failure;

+(NSURLSessionDataTask *)jsonRequestURL:(NSString *)url requestParam:(GLHTTPParam *)param success:(void (^)(GLHTTPResult * result))success failure:(void (^)(NSError *error))failure;

+(NSURLSessionDataTask *)getRequestURL:(NSString *)url requestParam:(GLHTTPParam *)param success:(void (^)(GLHTTPResult * result))success failure:(void (^)(NSError *error))failure;

+(void)setLoginToken:(NSString *)loginToken;

@end
